<div class="bt_nyhed2">
    <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="newsletter">
        <label>nyhedsbrev tilmelding</label>
        <input id="subscriber_email" name="subscriber_email" type="text" class="txt_nyhed2" value="Indtast din email adresse..." />
        <input id="subscriber_button" name="subscriber" type="image" src="catalog/view/theme/<?php echo $template; ?>/images/bt_send1.png" />
    </form>
    <br class="cb" />
</div>

<!-- Dialog -->
<div id='confirm'>
    <div class='header'><span>Confirm</span></div>
    <div class='message'></div>
    
    <div class='buttons'>
        <div id="button_continue" class='continue'>Fortsæt</div> 
        <div id="button_no" class='no simplemodal-close'>Ingen</div>
        <div id="button_yes" class='yes'>Ja</div>                  
    </div>
    <br/>
</div>

<script type="text/javascript">
    //var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;         
    var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,6})+$/;
    
    jQuery('#subscriber_button').live('click', function(event){
        event.preventDefault();
        
        if(!mail_filter.test(jQuery('#subscriber_email').val())){  
            confirm('Nyhedsbreve', 'Venligst e-mail skal udfylde.', 'notify');
            setTimeout("jQuery('.simplemodal-close').click()", 10000);    
            return false;
        }
        
        jQuery.post(
            "<?php echo $subscriber_url; ?>", 
            {email: jQuery('#subscriber_email').val()},
            function(data){                    
                confirm('Nyhedsbreve', data, 'notify');                
                setTimeout("jQuery('.simplemodal-close').click()", 10000);
                jQuery('#subscriber_email').focus();
            }
        );
        jQuery('#subscriber_email').val('');
        
        return false;
    });
    
    jQuery(document).ready(function(){        
        var hint = 'Indtast din email adresse...';
        jQuery('#subscriber_email').focus(function(e) {
            if (jQuery(this).val() == hint) {
                jQuery(this).val('');
            }
        });
        jQuery('#subscriber_email').blur(function(e) {
            if (jQuery(this).val() == '') {
                jQuery(this).val(hint);
            }
        });
    });
</script>



<div id="newsletter">
    <div class="left-bar">
        <div class="right-bar">
            <div class="bar-ct">
                <div class="desc float_left">
                    <h1><img src="catalog/view/theme/<?php echo $template; ?>/images/nyhedsbrev_title.png" alt="Nyhedsbrev" /></h1>
                    <p>Tilmeld dig og deltag i lodtrækningen om et gavekort til <span>1000,-</span> hver måned</p>
                </div>
                <div class="form-newsletter float_right">
                    <form id="newsletterForm" action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post">
                        <fieldset>
                            <input id="subscriber_email" class="txt_nyhed2" name="subscriber_email" type="text" value="Indtast din email adresse..." />
                            <input id="subscriber_button" name="subscriber" type="image" src="catalog/view/theme/<?php echo $template; ?>/images/bt_send1.png" />                            
                        </fieldset>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- Dialog -->
<div id='confirm'>
    <div class='header'><span>Confirm</span></div>
    <div class='message'></div>
    
    <div class='buttons'>
        <div id="button_continue" class='continue'>Fortsæt</div> 
        <div id="button_no" class='no simplemodal-close'>Ingen</div>
        <div id="button_yes" class='yes'>Ja</div>                  
    </div>
    <br/>
</div>

<script type="text/javascript">
    //var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;         
    var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{2,6})+$/;
    
    jQuery('#subscriber_button').live('click', function(event){
        event.preventDefault();
        
        if(!mail_filter.test(jQuery('#subscriber_email').val())){  
            confirm('Nyhedsbreve', 'Venligst e-mail skal udfylde.', 'notify');
            setTimeout("jQuery('.simplemodal-close').click()", 10000);    
            return false;
        }
        
        jQuery.post(
            "<?php echo $subscriber_url; ?>", 
            {email: jQuery('#subscriber_email').val()},
            function(data){                    
                confirm('Nyhedsbreve', data, 'notify');                
                setTimeout("jQuery('.simplemodal-close').click()", 10000);
                jQuery('#subscriber_email').focus();
            }
        );
        jQuery('#subscriber_email').val('');
        
        return false;
    });
    
    jQuery(document).ready(function(){        
        var hint = 'Indtast din email adresse...';
        jQuery('#subscriber_email').focus(function(e) {
            if (jQuery(this).val() == hint) {
                jQuery(this).val('');
            }
        });
        jQuery('#subscriber_email').blur(function(e) {
            if (jQuery(this).val() == '') {
                jQuery(this).val(hint);
            }
        });
    });
</script>